package cn.com.roy.thread.t4_1_10.lockmethodtest3;

public class Run {
    public static void main(String[] args) {
        try {
            final MyService service = new MyService();
            final Runnable runnable = new Runnable() {
                public void run() {
                    service.waitMethod();
                }
            };

            Thread[] threads = new Thread[10];
            for (int i = 0; i < 10; i++) {
                threads[i] = new Thread(runnable);
            }
            for (int i = 0; i < 10; i++) {
                threads[i].start();
            }
            Thread.sleep(2000);
            service.signalMethod(); //getWaitQueueLength(Condition condtion) 的作用是获取等待此锁定相关给定条件的线程估计数
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
